 <%@ page language="java" import="java.util.*" pageEncoding="utf-8" import="pojo.*,base.*,service.*,java.text.*,java.sql.*"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>


<html>
  <head>
    <link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
    <link href="../bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" media="screen">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <style type="text/css">
  #part a{margin:0 4px;}
</style>
<script type="text/javascript" src="../jquery/jquery-1.6.1.js"></script>
<script type="text/javascript" src="../jquery/jquery.validate.min.js"></script>
 


<script type="text/javascript">
$(function(){
 var $li=$('#total #part a');
    $li.click(function(){
        $(this).css('color','red').siblings().removeAttr('style');
        var index =  $li.index(this);
        $("#listbox > div").eq(index).fadeIn().siblings().hide();
    });
});



</script>

  </head>
  
  <body >
  <div class="span6" style="margin-bottom:20px;" id="total">
  <div class="row-fluid">
  <div class="span5" id="part"><a href="javascript:void(0);" title="总体评价"> 总体评价</a>|
  <a href="javascript:void(0);" title="菜品评价">菜品评价</a></div>
  </div>
  </div><br/>
  <div id="listbox" style="float:left;">
  <div style="float:left;">
<%
	request.setCharacterEncoding("utf-8");
	int id=(Integer)session.getAttribute("id");
	ReviewService rs=new ReviewService();
    String where=" where userid="+id+"";         
	
    int size=rs.getALL(where);
    String spageno = request.getParameter("pageno");
    int pageno;//页码
    int pagesize=5;//每页显示行数
    if(spageno==null){ pageno = 1;}//当页码为空时默认为1
    else pageno=Integer.parseInt(request.getParameter("pageno"));//否则为传过来的页码
	try{pageno = Integer.parseInt(spageno);}
	catch(Exception e){}
	Page p1=new Page();
								p1.setTotalRecord(size);
								p1.setCurrentPageNo(pageno);
								p1.setPageSize(pagesize);	
	List<review> list = rs.getReview(pageno,pagesize,where);//按参数查询	

		
	
%>
 
	<table class="table table-hover">
      <tr>
        <td width=100px;>评论时间</td>
        <td width=200px;>订单编号</td>
        <td width=200px;>评价等级</td>
        <td width=700px;>评价内容</td>
      </tr>
<%
	for (review re : list) {
	out.println("<input type='hidden' name='id' value='"+re.getId()+"'>");
	out.println("<tr><td>"+re.getTime()+"</td>");
	OrderService os=new OrderService();
    out.println("<td><a href='../orderdetails.jsp?coad="+os.getOrderDetail(re.getOrderid()).getCoad()+"'>"+os.getOrderDetail(re.getOrderid()).getCoad()+"</a></td>");
    int s=re.getLevel();
    if(s==1){
    out.println("<td>好评</td>");
    }
    else if(s==2){
    out.println("<td>中评</td>");
    }
    else out.println("<td>差评</td>");
	
	out.println("<td><div align='center'>"+re.getContent()+"</div></td></tr>");
	
	
	}
	
	out.println("<tr><td colspan='9'><h5>共"+p1.getTotalPage()+"页，当前第"+pageno+"页， ---<a href='myreview.jsp?&pageno="+p1.getPrePage()+"'>上一页</a>");
								 out.print("<a href='myreview.jsp?&pageno="+p1.getNextPage()+"'>下一页</a></h5></td></tr>");
%>
	
	
	
</table>
</div>
<div style="float:left;display:none;">
<%
	request.setCharacterEncoding("utf-8");
	
	List<DishesReview> reviewlist = rs.getDishesReview(where);//按参数查询	
    SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	for(int i=0,length=reviewlist.size();i<length;i++){
		reviewlist.get(i).setDate(df.format(reviewlist.get(i).getTime()));
	}	
		
	
%>
 
	 <table class="table table-hover">
      <tr>
        <td width=200px;>评论时间</td>
        <td width=200px;>菜名</td>
        <td width=50px;>色彩</td>
        <td width=50px;>香味</td>
        <td width=50px;>味道</td>
        <td width=400px;>评价内容</td>
      </tr>
  <%
  for (DishesReview re : reviewlist) {
	out.println("<input type='hidden' name='id' value='"+re.getId()+"'>");
	out.println("<tr><td>"+re.getDate()+"</td>");
	DishesService ds = new DishesService();
    out.println("<td>"+ds.getDishesDetail(re.getDishesid()).getName()+"</td>");
    int s=re.getColor();
    if(s==1){
    out.println("<td>优</td>");
    }
    else if(s==2){
    out.println("<td>中</td>");
    }
    else if(s==3) out.println("<td>差</td>");
	
	int a=re.getSmell();
    if(a==1){
    out.println("<td>优</td>");
    }
    else if(a==2){
    out.println("<td>中</td>");
    }
    else if(a==3)  out.println("<td>差</td>");
    
    int d=re.getTaste();
    if(d==1){
    out.println("<td>优</td>");
    }
    else if(d==2){
    out.println("<td>中</td>");
    }
    else if(d==3) out.println("<td>差</td>");
    
	out.println("<td><div align='center'>"+re.getContent()+"</div></td></tr>");
	
	
	}
	
%>
      </table>
</div>
</div>
  </body>
</html>
